#include "head_files.h"
#include "task_pool.h"
//if you want to change the showed name of func,change in init.c
void user_task1_start(void *argument)
{
	while(1)
	{
		uint8_t dataToSend[10] = "hello\r\n";
		HAL_UART_Transmit_DMA(&huart2,dataToSend,8);
		uart_transmit_float(126.32,3,2);
//		HAL_UART_Transmit_DMA(&huart2,row_end,8);
    osDelay(1000);
	}
}

void user_task2_start(void *argument)
{
	uint16_t spi1_tx_progress_time = 0;
	
	HAL_SPI_Receive_DMA(&hspi1,spi1_rx_buffer,5);
	
	while(1)
	{
		
		if(spi1_transfer_in_progress)
		{
			spi1_tx_progress_time++;
			if(spi1_tx_progress_time > 1000)
			{
				spi1_tx_progress_time = 0;
				spi1_transfer_in_progress = 0;
				HAL_SPI_Abort(&hspi1);
				Clean_SPI_Buffer(&hspi1);
			}
		}
		else
		{
			spi1_tx_progress_time = 0;
		}
		
		HAL_GPIO_WritePin(onboard_led_GPIO_Port,onboard_led_Pin,GPIO_PIN_RESET);
		
		if(spi1_rx_end_flag)
		{
			for(int16_t i = 0;i < 6;i ++)
			{
				HAL_GPIO_TogglePin(onboard_led_GPIO_Port,onboard_led_Pin);
				osDelay(50);
			}
			spi1_rx_end_flag = 0;
		}
		
		osDelay(1);
	}
}

void user_task3_start(void *argument)
{
	
	while(1)
	{
		MOTOR_send_s.id = 0;
		MOTOR_send_s.mode = 1;
		MOTOR_send_s.W = 0;
		MOTOR_send_s.K_W = 0;
		SERVO_Send(&MOTOR_send_s);
		osDelay(1);
	}
}

void user_task4_start(void *argument)
{
	
	while(1)
	{
		
		osDelay(100);
	}
}

void user_task5_start(void *argument)
{
	while(1)
	{
		
		osDelay(100);
	}
}

